package net.xxcxcxcx.xc_enhancedmob.component;

import net.minecraft.entity.EntityData;
import net.minecraft.entity.SpawnReason;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.ServerWorldAccess;
import org.jetbrains.annotations.Nullable;

/**
 * 这个接口是所有要附加在实体上面数据要继承的接口
 */
public interface BaseComponent {
    //对于自定义数据的存储
    default void writeCustomDataToNbt(NbtCompound nbt) {
    }

    //对于自定义数据的读取
    default void readCustomDataFromNbt(NbtCompound nbt) {
    }

    //实体在初始化时候调取的方法
    default EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData, @Nullable NbtCompound entityNbt) {
        return null;
    }

    //实体在每tick调取的方法
    default void tick() {
    }

    //开始实体追踪
    default void onStartedTrackingBy(ServerPlayerEntity player) {
    }

    //终止实体追踪
    default void onStoppedTrackingBy(ServerPlayerEntity player) {
    }
}
